<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="/global/jsp-header.jsp"%>
<c:set var="operator" value="${operatorType eq 1}"></c:set>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html">
		<title>访问路径列表</title>
		<%@ include file="/global/tablesort-header.jsp"%>
		<script>
		var rs = "${allActionUri.size()}";
		rs = ((!rs)? 0 : parseInt(rs))+1;
		var h = rs * 27 + 50;
		$(window.parent.document).find("#queryResult").removeClass("hide");
		$(window.parent.document).find("#actionUriResultIframe").height(h+100);
		
		$(document).ready(function(){
			window.parent.updateTitle("${menu.menuName}");
			$(':radio').attr('disabled', true);
			$(':checkbox:checked').each(function(){
				$(this).parent().siblings().find(':radio').removeAttr('disabled');
			});

			$(':checkbox[name=actionIds]').click(function(){
				if($(this).attr('checked')) {
					$(this).parent().siblings().find(':radio').removeAttr('disabled');
				} else {
					$(this).parent().siblings().find(':radio').attr('disabled', true);
				}
			});
			
			<c:if test="${operator}">
				setTimeout("window.parent.closeOperatorDialog();", 3000);
			</c:if>
		});
		</script>
	</head>
	<body>
	<c:choose>
		<c:when test="${operator }">
			${ operatorMsg}
		</c:when>
		<c:otherwise>
			<c:if test="${allActionUri.size() > 0}">
				<table id="myTable" cellspacing="1" class="tablesorter">
					<thead>
						<tr>
							<th>
								操作编号
							</th>
							<th>
								操作名
							</th>
							<th>
								注释
							</th>
						</tr>
					</thead>
					<tbody>
						<form action="/rbac/edit-menu-with-action.do" name="myform" id="myform"  method="post">
							<input type="hidden" name="menu.menuId" value="${menu.menuId }">
							<c:forEach items="${allActionUri }" var="item">
								<tr actionId=${item.actionId }>
									<c:set value="${false}" var="aomChecked"></c:set>
						 			<c:forEach items="${dataList}" var="aom">
						 				<c:if test="${!aomChecked && item.actionId eq aom.actionId}">
						 					<c:set value="${true}" var="aomChecked"></c:set>
						 				</c:if>
						 			</c:forEach>
									<td>
	 									<label for="a_${item.actionId }">${item.actionId }</label>
										<input type="checkbox" name="actionIds" value="${item.actionId }" ${aomChecked ? 'checked="checked"' : '' }/>
									</td>
									<td>
										${item.actionName }
									</td>
									<td>
										${item.note }
									</td>
								</tr>
							</c:forEach>
							<input type="submit"  class="button blue" value="提交" />
						</form>
					</tbody>
				</table>
			</c:if>
			<c:if test="${allActionUri.size() <= 0}">
				<div class="emptyResult">
					抱歉，没有找到相关操作路径。
				</div>
			</c:if>
	</c:otherwise>
	</c:choose>
	</body>
</html>
